/**
 * 用户监控页面路由
 */

var router = require('express').Router();
var assertAlljs = require('../bin/util/assert-alljs');
var userTool = require('../bin/user');
var monitorConfig = require('../bin/getConfig')('config/monitor.json');

router.get('/sitemonitor(.*)?', async function(req, res) {
    let user = req.session.user;
    let assert = assertAlljs(req, res);
    let checkMessage = userTool.check(user, {role: 'admin'});
    if (await assert(checkMessage))
        return;
    res.render('dyn.sitemonitor.html', monitorConfig);
});

module.exports = router;